<%= form_for :order, :url => populate_orders_path do |f| %>
  <div id="inside-product-cart-form" data-hook="inside_product_cart_form" itemprop="offers" itemscope itemtype="http://schema.org/Offer">

    <% if @product.variants_and_option_values_for(current_pricing_options).any? %>
      <div id="product-variants" class="columns five alpha">
        <h6 class="product-section-title"><%= Spree.t(:variants) %></h6>
        <ul>
          <% @product.variants_and_option_values_for(current_pricing_options).each_with_index do |variant, index| %>
            <li>
              <%= radio_button_tag "variant_id", variant.id, index == 0, 'data-price' => variant.price_for(current_pricing_options)  %>
              <%= label_tag "variant_id_#{ variant.id }" do %>
                <span class="variant-description">
                  <%= variant_options variant %>
                </span>
                <% if variant_price variant %>
                  <span class="price diff"><%= variant_price variant %></span>
                <% end %>

                <% unless variant.can_supply? %>
                  <span class="out-of-stock"><%= Spree.t(:out_of_stock) %></span>
                <% end %>
              <% end %>
            </li>
          <% end%>
        </ul>
      </div>
    <% else %>
      <%= hidden_field_tag "variant_id", @product.master.id %>
    <% end %>

    <% if @product.price_for(current_pricing_options) and !@product.price.nil? %>
      <div data-hook="product_price" class="columns five <% if !@product.has_variants? %> alpha <% else %> omega <% end %>">

        <div id="product-price">
          <h6 class="product-section-title"><%= Spree.t(:price) %></h6>
          <div>
            <span class="price selling" itemprop="price">
              <%= display_price(@product) %>
            </span>
            <span itemprop="priceCurrency" content="<%= current_pricing_options.currency %>"></span>
          </div>

          <% if @product.master.can_supply? %>
            <link itemprop="availability" href="http://schema.org/InStock" />
          <% elsif @product.variants.empty? %>
            <br />
            <span class="out-of-stock"><%= Spree.t(:out_of_stock) %></span>
          <% end %>
        </div>

        <div class="add-to-cart">
          <%= number_field_tag :quantity, 1, :class => 'title', :min => 1 %>
          <%= button_tag :class => 'large primary', :id => 'add-to-cart-button', :type => :submit do %>
            <%= Spree.t(:add_to_cart) %>
          <% end %>
        </div>
      </div>
    <% else %>
        <div id="product-price">
          <br>
          <div><span class="price selling" itemprop="price"><%= Spree.t('product_not_available_in_this_currency') %></span></div>
        </div>
    <% end %>
  </div>
<% end %>
